-include $(ROOTDIR)/config.mk

INCDIR += $(ROOTDIR)/include/client/ \
		   $(ROOTDIR)/package/debug/ \
		   $(ROOTDIR)/include/

INCLUDES = $(foreach INCTREE,$(INCDIR),$(addprefix -I, $(INCTREE)))


BIN = client
SOURCE += ./ \
		  ./../comm_protocol \
		  ./app \
		  ./device
OBJS = $(notdir $(patsubst %.c, %.o,$(foreach OBJTREE,$(SOURCE),$(wildcard $(OBJTREE)/*.c))))
#LIBS =

LDFLAGS := `pkg-config --cflags --libs gtk+-3.0`

vpath %.c $(SOURCE)	

.PHONY: all clean 

all: $(OBJS)
	$(CC) -o $(BIN) $(OBJS) $(LDFLAGS) $(LIBS) $(INCLUDES) -lpthread

.c.o:
	$(CC) $(CFLAGS) $(LDFLAGS) -c $< $(INCLUDES) -lpthread

clean:
	rm -rf $(BIN)  *.o